.class Les/pe0;
.super Ljava/io/OutputStream;
.source "OBEXOperationOutputStream.java"


# instance fields
.field private final a:Les/ne0;

.field private b:[B

.field private c:I

.field private d:Ljava/lang/Object;

.field private e:Z


# direct methods
.method constructor <init>(ILes/ne0;)V
    .locals 1

    .line 1
    invoke-direct {p0}, Ljava/io/OutputStream;-><init>()V

    .line 2
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Les/pe0;->d:Ljava/lang/Object;

    const/4 v0, 0x0

    .line 3
    iput-boolean v0, p0, Les/pe0;->e:Z

    .line 4
    iput-object p2, p0, Les/pe0;->a:Les/ne0;

    add-int/lit8 p1, p1, -0xb

    .line 5
    new-array p1, p1, [B

    iput-object p1, p0, Les/pe0;->b:[B

    .line 6
    iput v0, p0, Les/pe0;->c:I

    return-void
.end method


# virtual methods
.method a(Z)V
    .locals 5
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Les/pe0;->d:Ljava/lang/Object;

    monitor-enter v0

    .line 2
    :try_start_0
    iget v1, p0, Les/pe0;->c:I

    new-array v1, v1, [B

    .line 3
    iget-object v2, p0, Les/pe0;->b:[B

    iget v3, p0, Les/pe0;->c:I

    const/4 v4, 0x0

    invoke-static {v2, v4, v1, v4, v3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 4
    iget-object v2, p0, Les/pe0;->a:Les/ne0;

    invoke-interface {v2, p1, v1}, Les/ne0;->a(Z[B)V

    .line 5
    iput v4, p0, Les/pe0;->c:I

    .line 6
    monitor-exit v0

    return-void

    :catchall_0
    move-exception p1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1
.end method

.method public close()V
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-boolean v0, p0, Les/pe0;->e:Z

    if-nez v0, :cond_1

    .line 2
    iget-object v0, p0, Les/pe0;->d:Ljava/lang/Object;

    monitor-enter v0

    const/4 v1, 0x1

    .line 3
    :try_start_0
    iput-boolean v1, p0, Les/pe0;->e:Z

    .line 4
    iget-object v2, p0, Les/pe0;->a:Les/ne0;

    invoke-interface {v2}, Les/me0;->isClosed()Z

    move-result v2

    if-nez v2, :cond_0

    .line 5
    invoke-virtual {p0, v1}, Les/pe0;->a(Z)V

    .line 6
    :cond_0
    monitor-exit v0

    goto :goto_0

    :catchall_0
    move-exception v1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v1

    :cond_1
    :goto_0
    return-void
.end method

.method public flush()V
    .locals 1
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget v0, p0, Les/pe0;->c:I

    if-lez v0, :cond_0

    const/4 v0, 0x0

    .line 2
    invoke-virtual {p0, v0}, Les/pe0;->a(Z)V

    :cond_0
    return-void
.end method

.method public write(I)V
    .locals 3
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    const/4 v0, 0x1

    new-array v1, v0, [B

    int-to-byte p1, p1

    const/4 v2, 0x0

    aput-byte p1, v1, v2

    .line 1
    invoke-virtual {p0, v1, v2, v0}, Les/pe0;->write([BII)V

    return-void
.end method

.method public write([BII)V
    .locals 7
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 2
    iget-object v0, p0, Les/pe0;->a:Les/ne0;

    invoke-interface {v0}, Les/me0;->isClosed()Z

    move-result v0

    if-nez v0, :cond_6

    iget-boolean v0, p0, Les/pe0;->e:Z

    if-nez v0, :cond_6

    if-eqz p1, :cond_5

    if-ltz p2, :cond_4

    if-ltz p3, :cond_4

    add-int v0, p2, p3

    .line 3
    array-length v1, p1

    if-gt v0, v1, :cond_4

    if-nez p3, :cond_0

    return-void

    .line 4
    :cond_0
    iget-object v0, p0, Les/pe0;->d:Ljava/lang/Object;

    monitor-enter v0

    const/4 v1, 0x0

    const/4 v2, 0x0

    :cond_1
    :goto_0
    if-ge v2, p3, :cond_3

    .line 5
    :try_start_0
    iget-object v3, p0, Les/pe0;->b:[B

    array-length v3, v3

    iget v4, p0, Les/pe0;->c:I

    sub-int/2addr v3, v4

    sub-int v4, p3, v2

    if-ge v4, v3, :cond_2

    move v3, v4

    :cond_2
    add-int v4, p2, v2

    .line 6
    iget-object v5, p0, Les/pe0;->b:[B

    iget v6, p0, Les/pe0;->c:I

    invoke-static {p1, v4, v5, v6, v3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V

    .line 7
    iget v4, p0, Les/pe0;->c:I

    add-int/2addr v4, v3

    iput v4, p0, Les/pe0;->c:I

    add-int/2addr v2, v3

    .line 8
    iget-object v3, p0, Les/pe0;->b:[B

    array-length v3, v3

    if-ne v4, v3, :cond_1

    .line 9
    iget-object v3, p0, Les/pe0;->a:Les/ne0;

    iget-object v4, p0, Les/pe0;->b:[B

    invoke-interface {v3, v1, v4}, Les/ne0;->a(Z[B)V

    .line 10
    iput v1, p0, Les/pe0;->c:I

    goto :goto_0

    .line 11
    :cond_3
    monitor-exit v0

    return-void

    :catchall_0
    move-exception p1

    monitor-exit v0
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw p1

    .line 12
    :cond_4
    new-instance p1, Ljava/lang/IndexOutOfBoundsException;

    invoke-direct {p1}, Ljava/lang/IndexOutOfBoundsException;-><init>()V

    throw p1

    :cond_5
    const/4 p1, 0x0

    .line 13
    throw p1

    .line 14
    :cond_6
    new-instance p1, Ljava/io/IOException;

    const-string p2, "stream closed"

    invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V

    goto :goto_2

    :goto_1
    throw p1

    :goto_2
    goto :goto_1
.end method
